package org.guangzhou.notepad.activity;

import org.guangzhou.notepad.R;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.ListView;
import android.widget.Toast;

public class ListNoteActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.list_note);
        
        ListView list = (ListView) findViewById(R.id.list_note);
        
        
        
    }
    
    
    
    
    
    
    
 // 重写 onCreateOptionsMenu 用以创建选项菜单
    @Override
	public boolean onCreateOptionsMenu(Menu menu) {

		MenuItem menuItem = menu.add(0, 0, 0, "主菜单");
		
		// MenuItem.setIcon() - 设置菜单项的图标
		// MenuItem.setTitleCondensed() - 菜单的简标题，如果指定了简标题的话，菜单项上的标题将会以此简标题为准
		// MenuItem.setAlphabeticShortcut() - 设置选中此菜单项的快捷键
		// 注：菜单项超过 6 个的话，第 6 个菜单将会变为  More 菜单，多余的菜单会在单击 More 菜单之后显示出来
		//menuItem.setIcon(R.drawable.icon01);
		menuItem.setTitleCondensed("写日志");//也在主菜单同一位置
		//add (int groupId, int itemId, int order, CharSequence title) 
		menu.add(0, 1, 1, "分享");//.setIcon(R.drawable.icon03);
		menu.add(0, 2, 2, "修改资料");
		menu.add(0, 3, 3, "查询");
		menu.add(0, 4, 4, "设置");
		menu.add(0, 5, 5, "退出程序");//.setIcon(R.drawable.icon04);
		menu.add(0, 6, 6, "关于我们");//.setIcon(R.drawable.icon05);

		return true;
	}
    
    // 重写 onOptionsItemSelected 用以响应选项菜单
	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		super.onOptionsItemSelected(item);
		
		switch(item.getItemId()){
		
			case 0:
				Intent addInt = new Intent(this, AddNoteActivity.class);
				this.startActivity(addInt);
				break;
			case 1:
				Toast.makeText(this, "已经分享完毕", Toast.LENGTH_SHORT).show();
				break;
			case 2:
				Intent updateUserInt = new Intent(this, EditUserActivity.class);//定义一个传送到CityAddActivity的intent
				this.startActivity(updateUserInt);
				break;
			case 3:
				Toast.makeText(this, "正在查询......", Toast.LENGTH_SHORT).show();
				break;
			case 4:
				Toast.makeText(this, "设置完成......", Toast.LENGTH_SHORT).show();
				break;
			case 5:
				finish();
				break;
			
		}
		return false;
	}
    
}